package com.meng.thrift.server.thrift.inter_impl;

import com.meng.thrift.server.thrift.util.PublishThriftServer;
import com.meng.thrift.server.thrift.entity.User;
import com.meng.thrift.server.thrift.inter.UserService;
import org.apache.thrift.TException;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


/**
 * 用户服务
 *
 * @author MENG
 * @version 2017/11/3
 * @see
 */
@PublishThriftServer(port = 8192)
public class UserServiceImpl implements UserService.Iface
{
    /**
     *
     * 根据条件查询获取用户
     *
     * @param paramMap    key：username，password   =null 查询全部
     * @return 用户
     * @throws TException thrift的Exception
     */
    @Override
    public List<User> getUser(Map<String, String> paramMap)
        throws TException
    {
        System.out.println("...执行 UserService 的 getUser 方法");

        List<User> userList = new ArrayList<User>(2);

        User user = new User();

        user.setUsername("MENG");

        user.setPassword("MENGJIANJUN");

        user.setIsLogin(true);

        userList.add(user);

        return userList;
    }
}
